#ifndef VIEW3DINTERACTORSTYLE_H
#define VIEW3DINTERACTORSTYLE_H

#include <QObject>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkPropPicker.h>
#include <vtkObjectFactory.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkCamera.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkActor.h>
#include <anatomicalregion.h>
#include <anatomicallink.h>
#include <QVector>
#include <QPoint>
#include <QTimer>
#include <views/abstractView.h>

class View3DInteractorStyle : public QObject, public vtkInteractorStyleTrackballCamera
{
	Q_OBJECT

signals:
	void viewPointChanged(vtkRenderer *thisRenderer);
	void selectedRegionsChanged(const QVector<int> &, AbstractView::SelectAction);
	void selectedLinksChanged(const QVector<QPoint> &, AbstractView::SelectAction);

	void objectInfoRequested(const QPoint&,int regionId1,int regionId2); 

public slots:
	void on_viewPointChanged(vtkRenderer *otherRenderer);
	void on_requestInfo();

public:
	static View3DInteractorStyle *New();
	void setRenderer(vtkRenderer* render);
	
	virtual void Rotate();
	virtual void Spin();
	virtual void Pan();
	virtual void Dolly();
	virtual void OnMouseMove();
	virtual void OnLeftButtonDown();
	virtual void OnLeftButtonUp();
	virtual void OnMiddleButtonDown();
	virtual void OnMiddleButtonUp();
	virtual void OnRightButtonDown();
	virtual void OnRightButtonUp();

protected:
	View3DInteractorStyle();
	~View3DInteractorStyle();

private:
	vtkPropPicker *propPicker;
	vtkRenderer* renderer;
	bool isMouseMoving;
	QPoint *lastPos;
	QTimer *timer;
	QVector<int> selectedRegions;
	QVector<QPoint> selectedLinks;
};

#endif // VIEW3DINTERACTORSTYLE_H